/*
 * lab12A.c
 *   CSIS 248 Lab 12
 */
#include <stdio.h>

int main(int n, char** av){
   char* filename = "xyz";
   int i=0;

   while (1){
      FILE* out = fopen( filename, "w" );
      if (out == NULL) {
         fprintf( stderr, "%s: cannot open %s\n", av[0], filename);
         return -1;
      }
      fprintf( out, "%d", i);
      fclose( out );
      
      FILE* in = fopen( filename, "r" );
      if (in == NULL) {
         fprintf( stderr, "%s: cannot open %s\n", av[0], filename);
         return -1;
      }
      fscanf( in, "%d", &i);
      fclose( in );
      
      i++;
   }
}
